<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>基础平台V0.1</title> 

</head>
<jsp:include page="../default.jsp" />
<body>
<div id="loginWindow" class="mini-window" title="用户登录" style="width:350px;height:165px;" 
   showModal="true" showCloseButton="false" allowDrag="false"
    >

    <div id="loginForm" style="padding:15px;padding-top:10px;">
        <table >
            <tr>
                <td style="width:60px;"><label>登录名：</label></td>
                <td>
                    <input name="loginName" class="mini-textbox" vtype="letterAndNumber;minLength:3;maxLength:10;" required="true" style="width:150px;"/>
                </td>    
            </tr>
            <tr>
                <td style="width:60px;"><label>密码：</label></td>
                <td>
                    <input name="password" class="mini-password" vtype="letterAndNumber;minLength:6;maxLength:10;" required="true" style="width:150px;"/>
                </td>
            </tr>            
            <tr>
                <td></td>
                <td style="padding-top:5px;">
                    <a onclick="login()" class="mini-button" style="width:60px;">登录</a>
                    <a onclick="CommonUtil.prototype.reset('loginForm')" class="mini-button" style="width:60px;">重置</a>
                </td>
            </tr>
        </table>
    </div>

</div>
		
	<script type="text/javascript">
		mini.parse();
		var loginWindow = mini.get("loginWindow");
        loginWindow.show();
        var form = new mini.Form("#loginForm");
        
		function login() {
            form.validate();
            if (form.isValid() == false) return;           
            CommonUtil.prototype.mask();
			$.ajax({
				url : "${pageContext.request.contextPath}/system/logon.do",
				data : form.getData(true),
				type : "POST",
				dataType : "json",
				success : function(data, textStatus, jqXHR) {
					CommonUtil.prototype.unmask();
					if(data.success){
						loginWindow.hide();
						CommonUtil.prototype.mask("登录成功，正在进入系统");
						setTimeout(function () {
                			window.location = "${pageContext.request.contextPath}/system/toIndex.do";
            			}, 1500);
					}				
				}
			});		                                             
        }	
	</script>

</body>
</html>
